<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>文章管理 - 新增文章</title>
<?php include($this->c['_homes']['_viewsHome'].'/_global/_head.php');?>
</head>
<!-- BEGIN BODY -->
<body class="page-header-fixed page-sidebar-fixed">
<!-- BEGIN HEADER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/head.php');?>
<!-- END HEADER -->
<div class="clearfix"></div>
<!-- BEGIN CONTAINER -->
<div class="page-container" > 
  <!-- BEGIN HORIZONTAL MENU PAGE SIDEBAR1 -->
  <?php include($this->c['_homes']['_viewsHome'].'/_global/menu.php');?>
  <!-- END BEGIN HORIZONTAL MENU PAGE SIDEBAR --> 
  <!-- BEGIN PAGE -->
  <div class="page-content"> 
    <!-- BEGIN PAGE HEADER-->
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title"> 新增文章 </h3>
        <ul class="page-breadcrumb breadcrumb">
          <li> <i class="icon-home"></i> <a href="/manage">后台</a> <i class="icon-angle-right"></i> </li>
          <li> 文章管理 <i class="icon-angle-right"></i> </li>
          <li> <a href="/article/alist">文章列表</a> <i class="icon-angle-right"></i> </li>
          <li>新增文章</li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB--> 
      </div>
    </div>
    <!-- END PAGE HEADER--> 
    <!-- BEGIN PAGE CONTENT-->
    
    <div class="row">
      <div class="col-md-12"> 
        <!-- BEGIN SAMPLE FORM PORTLET-->
        <form class="form-horizontal" method="post" onSubmit="return chkfrm();" action="/article/savearticle" role="form">
          <input type="hidden" name="act" value="add">
          <div class="tabbable tabbable-custom boxless">
            <ul class="nav nav-tabs">
              <li class="active"><a href="#tab_0" data-toggle="tab">基本信息</a></li>
              <li class=""><a href="#tab_2" data-toggle="tab">文章详情</a></li>
            </ul>
            <div class="tab-content"> 
              <!--Tab0-->
              <div class="tab-pane active" id="tab_0">
                <div class="portlet box blue ">
                  <div class="portlet-title">
                    <div class="caption"> <i class="icon-reorder"></i> 基本资料 </div>
                  </div>
                  <div class="portlet-body form">
                    <div class="form-body">
                      <div class="form-group">
                        <label  class="col-md-2 control-label">文章名称<span class="required">*</span></label>
                        <div class="col-md-6">
                          <textarea name="title" id="_title" maxlength="200" class="form-control"  placeholder="请输入文章名称"><?=$this->data['title'];?></textarea>
                          <span class="help-block">200个汉字以内</span> 
                          </div>
                      </div>

                      <div class="form-group">
                        <label  class="col-md-2 control-label">文章简介<span class="required">*</span></label>
                        <div class="col-md-6">
                          <textarea name="keywords" id="_keywords" maxlength="200" class="form-control"  placeholder="请输入文章简介"><?=$this->data['keywords'];?></textarea>
                          <span class="help-block">200个汉字以内</span> 
                          </div>
                      </div>

                      <div class="form-group">
                        <label  class="col-md-2 control-label">文章分类<span class="required">*</span></label>
                        <div class="col-md-6">
                          <select name="caid" id="_caid" class="form-control">
                            <option value="">请选择分类</option>
                            <?php
                            if($this->cate[0]){
                              foreach($this->cate[0] as $r){
                              ?>
                                          <option value="<?=$r['caid'];?>">
                                          <?=$r['name'];?>
                                          </option>
                                          <?
                                if($this->cate[$r['caid']]){
                                  foreach($this->cate[$r['caid']] as $s){
                                    ?>
                                          <option value="<?=$s['caid'];?>">
                                          &nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;<?=$s['name'];?>
                                          </option>
                                          <?
                                  }
                                }
                              }
                            }             
                            ?>
                          </select>
                        </div>
                      </div>
                      <div class="form-group">
                        <label  class="col-md-2 control-label">作者姓名<span class="required">*</span></label>
                        <div class="col-md-6">
                          <input type="text" name="author" id="_author" maxlength="20" class="form-control"  placeholder="请输入作者姓名">
                          <span class="help-block">20个汉字以内</span> </div>
                      </div>
                      <hr>
                      <div class="form-group">
                        <label  class="col-md-2 control-label">模式选择</label>
                        <div class="col-md-6">
                          <select name="level_type" class="form-control">
                            <option value="0">所有模式</option>
                            <option value="1">VIP晋升</option>
                            <option value="2">代理晋升</option>
                          </select>
                        </div>
                      </div>
                      <hr>
                      <div class="form-group">
                        <label  class="col-md-2 control-label">跳转网址</label>
                        <div class="col-md-6">
                          <input type="text" name="urls" id="_urls" class="form-control">
                          <span class="help-block">必须以http://或https://开头</span> </div>
                      </div>
                      <div class="form-group">
                        <label class="col-md-2 control-label">显示</label>
                        <div class="col-md-9">
                          <div class="checkbox-list">
                            <label class="checkbox-inline">
                              <input id="inlineCheckbox21" value="1" name="is_open" type="checkbox">
                              打勾表示允许前台显示，否则不允许显示 </label>
                          </div>
                        </div>
                      </div>
                      
                      <div class="form-group">
                        <label class="col-md-2 control-label">文章属性</label>
                        <div class="col-md-9">
                          <div class="checkbox-list">
                            <label class="checkbox-inline">
                              <input  value="1" name="recommend" type="checkbox">
                              推荐 </label>
                              <label class="checkbox-inline">
                              <input  value="1" name="hots" type="checkbox">
                              热门 </label>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="form-actions fluid">
                      <div class="col-md-offset-3 col-md-9">
                        <button type="submit" class="btn green">提交</button>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!--Tab2-->
              <div class="tab-pane" id="tab_2">
                <div class="portlet box blue ">
                  <div class="portlet-title">
                    <div class="caption"> <i class="icon-reorder"></i> 文章详情 </div>
                  </div>
                  <div class="portlet-body form">
                    <div class="form-body">
                      <div class="form-group">
                        <label class="control-label col-md-2">详细内容</label>
                        <div class="col-md-10">
                          <textarea class="ckeditor form-control" id="content" name="content" rows="6" data-error-container="#content_error"></textarea>
                          <div id="content_error"></div>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="control-label col-md-2">上传图片</label>
                        <div class="col-md-10">
                          <iframe name="_upload" src="/article/upload" frameborder="0" width="100%" height="280" scrolling="auto"></iframe>
                        </div>
                      </div>
                    </div>
                    <div class="form-actions fluid">
                      <div class="col-md-offset-3 col-md-9">
                        <button type="submit" class="btn blue">提交</button>
                      </div>
                    </div>
                  </div>
                </div>
              </div>              

              <!--End Tab--> 

            </div>
          </div>
        </form>
        <!-- END SAMPLE FORM PORTLET--> 
      </div>
    </div>
    <!-- END PAGE CONTENT--> 
  </div>
  <!-- END PAGE --> 
</div>
<!-- END CONTAINER -->
<?php include($this->c['_homes']['_viewsHome'].'/_global/_footer.php');?>
<script type="text/javascript" src="/style/assets/plugins/ckeditor/ckeditor.js"></script> 
<script>
jQuery(document).ready(function() {    
   App.init();
});

function chkfrm(){
	if($("#_title").prop("value")==""){
		alert("请填写文章名称");
		$("#_title").focus();
		return false;
	}
  if($("#_keywords").prop("value")==""){
    alert("请填写文章简介");
    $("#_keywords").focus();
    return false;
  }
	
	if($("#_caid").val()==""){
    alert("请选择文章分类");
    $("#_caid").focus();
    return false;
  }
	
	if($("#_author").val()==""){
		alert("请填写作者姓名");
		$("#_author").focus();
		return false;
	}
  if($("#content").val()==""){
    alert("请填写详细内容");
    $("#content").focus();
    return false;
  }
		
}
function _insert_pic(u){
  var myckeditor = CKEDITOR.instances.content;
  myckeditor.insertHtml('<p><img src="'+u+'" /></p>');  
}
</script> 
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>